package com.tuiyun.jxgl.action;

import org.springframework.transaction.annotation.Transactional;

import com.tuiyun.jxgl.bean.Student;
import com.tuiyun.jxgl.dao.StudentHome;

public class ChangeStateAction {

	private int stuid;
	private byte to;
	private StudentHome sh;

	public StudentHome getSh() {
		return sh;
	}

	public void setSh(StudentHome sh) {
		this.sh = sh;
	}

	@Transactional
	public String execute() {
		
		Student s = sh.findById(stuid);
		if (s != null) {
			s.setState(to);
			sh.attachDirty(s);
		}
		return "success";
	}

	public int getStuid() {
		return stuid;
	}

	public void setStuid(int stuid) {
		this.stuid = stuid;
	}

	public byte getTo() {
		return to;
	}

	public void setTo(byte to) {
		this.to = to;
	}
}
